package com.horrorshallots.horrorshallotsblog2.deepseek.pojo;

import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
import lombok.Data;
import java.util.List;

public class DeepSeekRequest {
    private String model;
    private List<Message> messages;

    // 手动实现 Builder
    public static Builder builder() {
        return new Builder();
    }

    public static class Builder {
        private String model;
        private List<Message> messages;

        public Builder model(String model) {
            this.model = model;
            return this;
        }

        public Builder messages(List<Message> messages) {
            this.messages = messages;
            return this;
        }

        public DeepSeekRequest build() {
            DeepSeekRequest request = new DeepSeekRequest();
            request.model = this.model;
            request.messages = this.messages;
            return request;
        }
    }

    // 同理为 Message 类实现 Builder
    @Data
    @JsonInclude(JsonInclude.Include.NON_NULL)  // 忽略 null 字段
    public static class Message {
        @JsonProperty("role")     // 明确指定 JSON 字段名
        private String role;

        @JsonProperty("content")  // 明确指定 JSON 字段名
        private String content;

        public static MessageBuilder builder() {
            return new MessageBuilder();
        }

        public static class MessageBuilder {
            private String role;
            private String content;

            public MessageBuilder role(String role) {
                this.role = role;
                return this;
            }

            public MessageBuilder content(String content) {
                this.content = content;
                return this;
            }

            public Message build() {
                Message message = new Message();
                message.role = this.role;
                message.content = this.content;
                return message;
            }
        }
    }
}